package com.skit.common.config

import android.content.Context
import com.skit.common.ResourcesManager

/**
 * @author shuike [Contact me.](mailto:shuike007@gmail.com)
 * @version 1.0
 * @since 2020/5/21
 */
object AppConfig {
    //    public static final String BASE_HOST = "http://192.168.1.6:8080/";//HOST链接
    const val BASE_HOST = "http://ecm.skit.vip/" //HOST链接

    //    const val ROOT_URL = BASE_HOST //服务器地址
    @JvmStatic
    val ROOT_URL: String by lazy {
        return@lazy if (com.skit.common.BuildConfig.DEBUG) {
            ResourcesManager.getAppContext().getSharedPreferences("debug", Context.MODE_PRIVATE)
                .getString("url", null).let {
                    if (it.isNullOrEmpty()) {
                        BASE_HOST
                    } else {
                        it
                    }
                }
        } else {
            BASE_HOST
        }
    }
}